<?php
namespace Admin\Controller;
use Think\Controller;
class ArticlesController extends Controller {
    public function articleslist(){
    	//调用模型层获取数据
        $articlesModel=M('articles');
       // $type=M('type');
        // $this->type=$type->order("tid")->select();
        //var_dump($usermodel);
        $articles=$articlesModel->table('vm_articles a ,vm_users u')->where('a.u_id=u.u_id')->select();
    	//调用视图层显示数据
    	$this->articles=$articles;

    	$this->display();
    }
    



  public function detail($a_id){
        $articlesModel=M('articles');
       
     $articles=$articlesModel->table('vm_articles a ,vm_users u')->where("a_id = $a_id and a.u_id=u.u_id")->select(); 
        $this->articles=$articles;
       $this->display();
    } 
   
   
     public function delarticles($a_id){
   
    $articlesModel = M("articles"); // 实例化User对象
   // $articles=$articlesModel->where("t_id=$t_id")->select();
    $result=$articlesModel->where("a_id=$a_id")->delete(); 
        if($result){                    
            $this->success('删除成功');//设置成功后跳转页面的地址，默认的返回页面是$_SERVER['HTTP_REFERER']
            } else {
             $this->error('删除失败'); //错误页面的默认跳转页面是返回前一页，通常不需要设置
            }

    }




    }